package com.qf.controller;

import com.qf.service.DtsCollectService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/** 用户管理  会员收藏
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.controller
 * @Description:
 * @Date 2022/10/16 20:41
 */

@RestController
@RequestMapping("/admin/collect")
public class AdminCollectController {

    @Autowired
    DtsCollectService collectService;
//    admin/collect/list?page=1&limit=20&userId=1&valueId=1&sort=add_time&order=desc

    @GetMapping("/list")
    public Object list(@RequestParam(value = "page",required = false, defaultValue = "1") Integer page,
                       @RequestParam(value = "limit",required = false, defaultValue = "20")Integer limit,
                       @RequestParam(value = "sort",required = false, defaultValue = "add_time")String sort,
                       @RequestParam(value = "order",required = false, defaultValue = "desc")String order,
                       Integer valueId, Integer userId){

        Map<String,Object> data = collectService.selectByPage(page,limit,sort,order,valueId,userId);

        return ResponseUtil.ok(data);
    }
}
